home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 43.zip / Sources C- WorkDisk V.adf / iff / jiff-hires.h < prev    next >
C/C++ Source or Header  |  1987-02-15  |  3KB  |  129 lines

  1.  
  2. /************ I usually put these in a file called format.h ****/
  3.  
  4. #define HI_RES
  5.  
  6. #ifdef HI_RES
  7. #define XMAX 640
  8. #define YMAX 200
  9. #define PLANES 4
  10. #define MAXCOL (1<<PLANES)
  11. #define XASPECT 5
  12. #define YASPECT 11
  13. #endif HI_RES
  14.  
  15. #ifdef LO_RES
  16. #define XMAX 320
  17. #define YMAX 200
  18. #define PLANES 5
  19. #define MAXCOL (1<<PLANES)
  20. #define XASPECT 10
  21. #define YASPECT 11
  22. #endif LO_RES
  23.  
  24. /* EA handy make a long from 4 chars macros redone to work with Aztec*/
  25. #define MAKE_ID(a, b, c, d)\
  26.     ( ((long)(a)<<24) + ((long)(b)<<16) + ((long)(c)<<8) + (long)(d) )
  27.  
  28. /* these are the IFF types I deal with */
  29. #define FORM MAKE_ID('F', 'O', 'R', 'M')
  30. #define ILBM MAKE_ID('I', 'L', 'B', 'M')
  31. #define BMHD MAKE_ID('B', 'M', 'H', 'D')
  32. #define CMAP MAKE_ID('C', 'M', 'A', 'P')
  33. #define BODY MAKE_ID('B', 'O', 'D', 'Y')
  34.  
  35. /* and these are the IFF types I ignore but don't squawk about */
  36. #define GRAB MAKE_ID('G', 'R', 'A', 'B')
  37. #define DEST MAKE_ID('D', 'E', 'S', 'T')
  38. #define SPRT MAKE_ID('S', 'P', 'R', 'T')
  39. #define CAMG MAKE_ID('C', 'A', 'M', 'G')
  40. #define CRNG MAKE_ID('C', 'R', 'N', 'G')
  41. #define CCRT MAKE_ID('C', 'C', 'R', 'T')
  42.  
  43. /* Some macros for raster memory allocation ... redefine if you're
  44.    sensible and manage memory locally */
  45.  
  46. /* ralloc - raster alloc*/
  47. #define ralloc(amount)  (PLANEPTR)AllocMem((long)(amount), MEMF_CHIP)
  48. /* rfree - raster free*/
  49. #define rfree(pt, amount)    FreeMem( (pt), (long)(amount) )
  50.  
  51. /*line_bytes = the number of words * 2 (for bytes) a raster line takes up */
  52. #define line_bytes(width)    (((width+15)>>4)<<1)
  53.  
  54. /* psize - plane size in bytes (an even number) of a raster given
  55.    width and height */
  56. #define psize(width, height) ( line_bytes(width)*height)
  57.  
  58. /* the place to throw excess bits */
  59. #define bit_bucket(file, length) fseek(file, (long)(length), 1)
  60.  
  61.  
  62. union bytes4
  63.     {
  64.     char b4_name[4];
  65.     long b4_type;
  66.     };
  67.  
  68. struct iff_chunk
  69.     {
  70.     union bytes4 iff_type;
  71.     long iff_length;
  72.     };
  73.  
  74. struct form_chunk
  75.     {
  76.     union bytes4 fc_type; /* == FORM */
  77.     long fc_length;
  78.     union bytes4 fc_subtype;
  79.     };
  80.  
  81. struct BitMapHeader
  82.     {
  83.     UWORD w, h;
  84.     UWORD x, y;
  85.     UBYTE nPlanes;
  86.     UBYTE masking;
  87.     UBYTE compression;
  88.     UBYTE pad1;
  89.     UWORD transparentColor;
  90.     UBYTE xAspect, yAspect;
  91.     WORD pageWidth, pageHeight;
  92.     };
  93.  
  94. /*ILBM_info is the structure read_iff returns, and is hopefully all
  95.   you need to deal with out of the iff reader routines below*/
  96. struct ILBM_info
  97.     {
  98.     struct BitMapHeader header;
  99.     UBYTE cmap[MAXCOL*3];    /*say hey aztec don't like odd length structures*/
  100.     struct BitMap bitmap;
  101.     };
  102.  
  103.  
  104. /* I sure wish C function "prototypes" were real and not just ANSI */
  105. extern struct ILBM_info *read_iff();  /* read_iff( char *filename ); */
  106. extern void free_planes();        /* free_planes( struct BitMap *bitmap); */
  107. extern int write_iff();
  108. /* write_iff(char *name, unsigned char *colors, struct BitMap *bits,
  109.     short xoff, short yoff, short width, short compressed); */
  110.  
  111. extern char *AllocMem();
  112.  
  113.  
  114. /* Anyone know where some useful minterms are defined? */
  115. #define COPY_MINTERM        0xc0
  116.  
  117. /***
  118.  
  119.         A meditation for the guru from the Diamond Sutra -
  120.  
  121.         So shall you think of all this fleeting world:
  122.         A star at dawn, a bubble in a stream;
  123.         A flash of lightning in a summer cloud,
  124.         A flickering lamp, a phantom, and a dream.
  125.  
  126. ***/
  127.  
  128.  
  129.